﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RouteEdit.aspx.cs" Inherits="Omabar.CMS.CMS.RouteEdit" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" type="text/css" href="../CSS/bootstrap_min.css" media="all" />
    <link rel="stylesheet" type="text/css" href="../CSS/bootstrap_responsive_min.css" media="all" />
    <link rel="stylesheet" type="text/css" href="../CSS/Style.css" media="all" />
    <link rel="stylesheet" type="text/css" href="../CSS/todc_bootstrap.css" media="all" />
    <link rel="stylesheet" type="text/css" href="../CSS/Themes.css" media="all" />
    <link rel="stylesheet" type="text/css" href="../CSS/inside.css" media="all" />
    <script type="text/javascript" src="../JavaScript/jquery.1.8.3.js"></script>
    <script type="text/javascript" src="../JavaScript/jquery.cookie.js"></script>
    <script type="text/javascript" src="../JavaScript/bootstrap.js"></script>
    <script type="text/javascript" src="../JavaScript/jquery_validate_min.js"></script>
    <script type="text/javascript" src="../JavaScript/jquery_validate_methods.js"></script>
    <script type="text/javascript" src="../JavaScript/jquery_form_min.js"></script>
    <script type="text/javascript" src="../JavaScript/inside.js"></script>
    <title></title>
    <link rel="shortcut icon" href="../favicon.ico" />
    <!--[if IE 7]><link href="../CSS/font_awesome_ie7.css" rel="stylesheet" /><![endif]-->
    <!--[if lte IE 9]><script src="../JavaScript/watermark.js"></script><![endif]-->

    <script type="text/javascript" src="../KindEditor/kindeditor-min.js"></script>
    <script type="text/javascript" src="../KindEditor/kindeditor.config.js"></script>
    <script type="text/javascript" src="../KindEditor/kindeditor.config-upfile.js"></script>
</head>
<body>
    <div id="main">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="box">
                        <div class="box-title">
                            <div class="span10">
                                <h3><i class="icon-edit"></i>请填写旅游线路信息</h3>
                            </div>
                            <div class="span2"><a class="btn" href="Javascript:window.history.go(-1)">返回</a></div>
                        </div>

                        <div class="box-content">
                            <form action="../Handler/RouteEdit.ashx" method="post" class="form-horizontal form-validate">
                                <input type="hidden" name="ROUTE_ID" value="<%=id %>" />
                                <div class="control-group">
                                    <label for="ROUTE_NAME" class="control-label">旅游线路名称：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_NAME" id="ROUTE_NAME" style="width: 700px;" data-rule-required="true" value="<%=route.ROUTE_NAME %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_DES" class="control-label">旅游线路描述：</label>
                                    <div class="controls">
                                        <textarea name="ROUTE_DES" id="ROUTE_DES" style="width: 700px; height: 40px;" data-rule-required="true"><%=route.ROUTE_DES %></textarea><span class="maroon">*</span><span class="help-inline">
                                        </span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_CHARACTERISTIC" class="control-label">路线特色描述：</label>
                                    <div class="controls">
                                        <textarea name="ROUTE_CHARACTERISTIC" id="ROUTE_CHARACTERISTIC" style="width: 700px; height: 40px;" data-rule-required="true"><%=route.ROUTE_CHARACTERISTIC %></textarea><span class="maroon">*</span><span class="help-inline">
                                        </span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="picurl" class="control-label">路线特色选取：</label>
                                    <%--<div class="controls">
                                        <table class="dataTable-mini" id="characteristic_table">
                                            <%foreach (var characteristic in cctss){ %>
                                            <tr id="characteristic_table<%=characteristic.CHARACTERISTIC_ID%>">
                                                <td><input type="hidden" name="characteristic[0][]" value="<%=characteristic.CHARACTERISTIC_ID%>"/><%=characteristic.CHARACTERISTIC_NAME+"【"+characteristic.CHARACTERISTIC_DES+"】"%></td>
                                                <td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td>
                                            </tr>
                                            <%} %>    
                                        </table>
                                        <button id="btnAddCharacteristic" type="button" rel="characteristic_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">最多添加3个</span>
                                    </div>--%>
                                </div>
                                <div class="control-group">
                                    <label for="theme_table" class="control-label">路线主题选取：</label>
                                    <div class="controls">
                                        <table class="dataTable-mini" id="theme_table">
                                            <%foreach(var theme in themes){ %>
                                            <tr id="theme_table<%=theme.THEME_ID%>">
                                                <td><input type="hidden" name="theme[0][]" value="<%=theme.THEME_ID%>"/><%=theme.THEME_NAME%></td>
                                                <td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td>
                                            </tr>
                                            <%} %>    
                                        </table>
                                        <button id="btnAddTheme" type="button" rel="theme_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">最多添加3个</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_PRICE" class="control-label">首页显示价格：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_PRICE" id="ROUTE_PRICE" class="input-medium" data-rule-required="true" data-rule-number="true" value="<%=route.ROUTE_PRICE %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_CHENGDU" class="control-label">成都出发价格：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_CHENGDU" id="ROUTE_CHENGDU" class="input-medium" data-rule-required="true" data-rule-number="true" value="<%=route.ROUTE_CHENGDU %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_BEIJING" class="control-label">北京出发价格：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_BEIJING" id="ROUTE_BEIJING" class="input-medium" data-rule-required="true" data-rule-number="true" value="<%=route.ROUTE_BEIJING %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_ELSECITY" class="control-label">其他城市价格：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_ELSECITY" id="ROUTE_ELSECITY" class="input-medium" data-rule-required="true" value="<%=route.ROUTE_ELSECITY %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_DAYS" class="control-label">旅游天数：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_DAYS" id="ROUTE_DAYS" class="input-medium" data-rule-required="true" data-rule-number="true" value="<%=route.ROUTE_DAYS %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_DATE_START" class="control-label">出发日期：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_DATE_START" id="ROUTE_DATE_START" class="input-medium" data-rule-required="true" value="<%=route.ROUTE_DATE_START.ToString("yyyy-MM-dd") %>" /><span class="maroon">*</span>
                                        <span class="maroon">格式: 2015-01-15 12:30</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_DATE_END" class="control-label">返回日期：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_DATE_END" id="ROUTE_DATE_END" class="input-medium" data-rule-required="true" value="<%=route.ROUTE_DATE_END.ToString("yyyy-MM-dd")  %>" /><span class="maroon">*</span>
                                        <span class="maroon">格式: 2015-01-15 12:30</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_HOT" class="control-label">线路热度：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_HOT" id="ROUTE_HOT" class="input-medium" data-rule-required="true" data-rule-number="true" value="<%=route.ROUTE_HOT %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_ELABORATE" class="control-label">精品线路：</label>
                                    <div class="controls">
                                        <%if (route.ROUTE_ELABORATE == 1)
                                          {%>
                                        <input type="radio" checked="checked" name="ROUTE_ELABORATE" class="input-medium" data-rule-required="true" data-rule-number="true" value="1" />是
                                        <input type="radio" name="ROUTE_ELABORATE" class="input-medium" data-rule-required="true" data-rule-number="true" value="0" />否
                                        <%}
                                          else
                                          {%>
                                        <input type="radio" name="ROUTE_ELABORATE" class="input-medium" data-rule-required="true" data-rule-number="true" value="1" />是
                                        <input type="radio" checked="checked" name="ROUTE_ELABORATE" class="input-medium" data-rule-required="true" data-rule-number="true" value="0" />否
                                        <%} %>
                                        <span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_ORIGINAL" class="control-label">欧玛贝独创：</label>
                                    <div class="controls">
                                        <%if (route.ROUTE_ORIGINAL == 1){%>
                                        <input type="radio" checked="checked" name="ROUTE_ORIGINAL" class="input-medium" data-rule-required="true" data-rule-number="true" value="1" />是
                                        <input type="radio" name="ROUTE_ORIGINAL" class="input-medium" data-rule-required="true" data-rule-number="true" value="0" />否
                                        <%} else {%>
                                        <input type="radio" name="ROUTE_ORIGINAL" class="input-medium" data-rule-required="true" data-rule-number="true" value="1" />是
                                        <input type="radio" checked="checked" name="ROUTE_ORIGINAL" class="input-medium" data-rule-required="true" data-rule-number="true" value="0" />否
                                        <%} %>
                                        <span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="ROUTE_BAK" class="control-label">备注：</label>
                                    <div class="controls">
                                        <input type="text" name="ROUTE_BAK" id="ROUTE_BAK" style="width: 700px;" data-rule-required="true" value="<%=route.ROUTE_BAK %>" /><span class="maroon">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="city_table" class="control-label">旅途城市信息：</label>
                                    <div class="controls">
                                        <table class="dataTable-mini" id="city_table">
                                            <%foreach(var city in citys){ %>
                                            <tr id="city_table<%=city.ROUTE_CITY%>">
                                                <td><input type="hidden" name="city[0][]" value="<%=city.ROUTE_CITY%>"/><%=city.ROUTE_CITY%></td>
                                                <td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td>
                                            </tr>
                                            <%} %>   
                                        </table>
                                        <button id="btnAddCity" type="button" rel="city_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">最多添加9个</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="picurl" class="control-label">旅途酒店信息：</label>
                                    <div class="controls">
                                        <table class="dataTable-mini" id="hotel_table">
                                            <%foreach(var hotel in hotels){ %>
                                            <tr id="hotel_table<%=hotel.HOTEL_ID%>">
                                                <td><input type="hidden" name="hotel[0][]" value="<%=hotel.HOTEL_ID%>"/><%=hotel.HOTEL_NAME%></td>
                                                <td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td>
                                            </tr>
                                            <%} %>  
                                        </table>
                                        <button id="btnAddHotel" type="button" rel="hotel_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">最多添加9个</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="picurl" class="control-label">特色项目：</label>
                                    <div class="controls">
                                        <table class="dataTable-mini" id="specialitem_table">
                                            <%foreach(var spItem in specialItems){ %>
                                            <tr id="specialitem_table<%=spItem.SPECIALITEM_ID%>">
                                                <td><input type="hidden" name="specialitem[0][]" value="<%=spItem.SPECIALITEM_ID%>"/><%=spItem.SPECIALITEM_NAME+"【￥"+spItem.SPECIALITEM_PRICE +"】+"%></td>
                                                <td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td>
                                            </tr>
                                            <%} %>
                                        </table>
                                        <button id="btnAddSpecialitem" type="button" rel="specialitem_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">最多添加9个</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="picurl" class="control-label">路线美景：</label>
                                    <div class="controls">
                                        <table class="dataTable-mini" id="photo_table">
                                            <%foreach (var photo in photos)
                                              {%>
                                            <tr id="photo_tabletr<%=photo.PHOTO_ID%>">
                                                <td><input type="hidden" value="<%=photo.PHOTO_ID%>" name="photo[0][]" /><img src="<%=photo.PHOTO_URL%>" style="width: 40px; height: 30px; margin-right: 20px;" /><%=photo.PHOTO_NAME%></td>
                                                <td><a class="btn btn-mini del" href="javascript:void(0)"><i class="icon-remove"></i></a></td>
                                            </tr>
                                            <%}%>
                                        </table>
                                        <button id="btnAddPhoto" type="button" rel="photo_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">最多添加9个</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label for="btnAddTrip" class="control-label">行程安排：</label>
                                    <div class="controls">
                                        <table class="dataTable-mini" id="trip_table">
                                            <%foreach(var trip in trips){ %>
                                            <tr id="trip_table<%=trip.TRIP_ID%>">
                                                <td><input type="hidden" name="trip[0][]" value="<%=trip.TRIP_ID%>"/><%=trip.TRIP_NAME%></td>
                                                <td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td>
                                            </tr>
                                            <%} %>     
                                        </table>
                                        <button id="btnAddTrip" type="button" rel="trip_table" class="btn add-on">添加</button><span style="color: red;" class="help-inline">*</span>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary">保存</button>
                                    <a class="btn" href="Javascript:window.history.go(-1)">取消</a>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--选择路线特色-->
        <div id="characteristicModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择特色集</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            特色标题：
                            <input name="characteristicKey" id="characteristicKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindCharacteristic"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallCharacteristic" name="chkallCharacteristic" />
                            全选　共有 <span class="red" id="count_num_characteristic">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_characteristic"><strong>上一页</strong></button>
                            <span id="p_page_str">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_characteristic"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-characteristic-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _characteristicdata_table_id;
                            var _isosocharacteristic = false;
                            $("#chkallCharacteristic").click(function () {
                                var $idsCheck = $("#data-characteristic-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindCharacteristic").click(function () {
                                _isosocharacteristic = true;
                                $("#btnFindCharacteristic").attr("disabled", ""); _page(1)
                            });
                            $("#data-characteristic-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $desc = $this.attr("desc");
                                var $id = $this.val();
                                var $selecttr = $("#" + _characteristicdata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _characteristicdata_table_id + " tr").length < 9) {
                                        var t = (_characteristicdata_table_id == "characteristic_table") ? "characteristic[0][]" : "characteristic[1][]";
                                        var _trtmp = "<tr id='" + _characteristicdata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' />" + $title + "【" + $desc + "】</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _characteristicdata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddCharacteristic").click(function (e) {
                                e.preventDefault();
                                _characteristicdata_table_id = $(this).attr("rel");
                                $('#characteristicModel').modal('show');
                                $("#chkallCharacteristic").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_characteristic").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_characteristic").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var characteristicKey;
                                if (_isosocharacteristic) {
                                    characteristicKey = $("#characteristicKey").val();
                                }

                                $.get("../Handler/CharacteristicRead.ashx",
                                    { "key": characteristicKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-characteristic-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input type="checkbox" name="check" desc="' + item.CHARACTERISTIC_DES + '"  t="' + item.CHARACTERISTIC_NAME + '" value="' + item.CHARACTERISTIC_ID + '" />' + item.CHARACTERISTIC_NAME + '【' + item.CHARACTERISTIC_DES + '】</label></li>';
                                            $("#data-characteristic-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_characteristic").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindCharacteristic").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
        <!--选择主题-->
        <div id="themeModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择主题集</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            主题标题：
                            <input name="themeKey" id="themeKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindTheme"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallTheme" name="chkallTheme" />
                            全选　共有 <span class="red" id="count_num_theme">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_theme"><strong>上一页</strong></button>
                            <span id="Span4">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_theme"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-theme-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _themedata_table_id;
                            var _isosotheme = false;
                            $("#chkallTheme").click(function () {
                                var $idsCheck = $("#data-theme-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindTheme").click(function () {
                                _isosotheme = true;
                                $("#btnFindTheme").attr("disabled", ""); _page(1)
                            });
                            $("#data-theme-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $id = $this.val();
                                var $selecttr = $("#" + _themedata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _themedata_table_id + " tr").length < 9) {
                                        var t = (_themedata_table_id == "theme_table") ? "theme[0][]" : "theme[1][]";
                                        var _trtmp = "<tr id='" + _themedata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' />" + $title + "</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _themedata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddTheme").click(function (e) {
                                e.preventDefault();
                                _themedata_table_id = $(this).attr("rel");
                                $('#themeModel').modal('show');
                                $("#chkallTheme").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_theme").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_theme").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var themeKey;
                                if (_isosotheme) {
                                    themeKey = $("#themeKey").val();
                                }

                                $.get("../Handler/ThemeRead.ashx",
                                    { "key": themeKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-theme-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input type="checkbox" name="check" t="' + item.THEME_NAME + '" value="' + item.THEME_ID + '" />' + item.THEME_NAME + '</label></li>';
                                            $("#data-theme-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_theme").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindTheme").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
        <!--选择城市-->
        <div id="cityModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择城市信息</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            城市名称：
                            <input name="cityKey" id="cityKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindCity"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallCity" name="chkallCity" />
                            全选　共有 <span class="red" id="count_num_city">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_city"><strong>上一页</strong></button>
                            <span id="Span1">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_city"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-city-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _citydata_table_id;
                            var _isosocity = false;
                            $("#chkallCity").click(function () {
                                var $idsCheck = $("#data-city-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindCity").click(function () {
                                _isosocity = true;
                                $("#btnFindCity").attr("disabled", ""); _page(1)
                            });
                            $("#data-city-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $country = $this.attr("country");
                                var $continent = $this.attr("continent");
                                var $id = $this.val();
                                var $selecttr = $("#" + _citydata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _citydata_table_id + " tr").length < 9) {
                                        var t = (_citydata_table_id == "city_table") ? "city[0][]" : "city[1][]";

                                        var _trtmp = "<tr id='" + _citydata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' /><input type='hidden' name='country[0][]'  value='" + $country + "' /><input type='hidden' name='continent[0][]'  value='" + $continent + "' />" + $title + "</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _citydata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddCity").click(function (e) {
                                e.preventDefault();
                                _citydata_table_id = $(this).attr("rel");
                                $('#cityModel').modal('show');
                                $("#chkallCity").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_city").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_city").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var cityKey;
                                if (_isosocity) {
                                    cityKey = $("#cityKey").val();
                                }

                                $.get("../Handler/CityBelongRead.ashx",
                                    { "key": cityKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-city-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input style="margin-right:20px;" type="checkbox" name="check" country="' + item.ROUTE_COUNTRY_NAME + '" continent="' + item.ROUTE_CONTINENT + '"  t="' + item.ROUTE_CITY + '" value="' + item.ROUTE_CITY + '" />' + item.ROUTE_CITY + '</label></li>';
                                            $("#data-city-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_city").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindCity").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
        <!--酒店选择器-->
        <div id="hotelModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择酒店信息</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            酒店名称：
                            <input name="hotelKey" id="hotelKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindHotel"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallHotel" name="chkallHotel" />
                            全选　共有 <span class="red" id="count_num_hotel">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_hotel"><strong>上一页</strong></button>
                            <span id="Span2">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_hotel"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-hotel-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _hoteldata_table_id;
                            var _isosohotel = false;
                            $("#chkallHotel").click(function () {
                                var $idsCheck = $("#data-hotel-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindHotel").click(function () {
                                _isosohotel = true;
                                $("#btnFindHotel").attr("disabled", ""); _page(1)
                            });
                            $("#data-hotel-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $img = $this.attr("img");
                                var $id = $this.val();
                                var $selecttr = $("#" + _hoteldata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _hoteldata_table_id + " tr").length < 9) {
                                        var t = (_hoteldata_table_id == "hotel_table") ? "hotel[0][]" : "hotel[1][]";
                                        var _trtmp = "<tr id='" + _hoteldata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' />" + $title + "</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _hoteldata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddHotel").click(function (e) {
                                e.preventDefault();
                                _hoteldata_table_id = $(this).attr("rel");
                                $('#hotelModel').modal('show');
                                $("#chkallHotel").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_hotel").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_hotel").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var hotelKey;
                                if (_isosohotel) {
                                    hotelKey = $("#hotelKey").val();
                                }

                                $.get("../Handler/HotelRead.ashx",
                                    { "key": hotelKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-hotel-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input style="margin-right:20px;" type="checkbox" name="check"  t="' + item.HOTEL_NAME + '" value="' + item.HOTEL_ID + '" />' + item.HOTEL_NAME + '</label></li>';
                                            $("#data-hotel-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_hotel").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindHotel").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
        <!--特色项目-->
        <div id="specialitemModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择特色项目</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            特色项目标题：
                            <input name="specialitemKey" id="specialitemKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindSpecialitem"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallSpecialitem" name="chkallSpecialitem" />
                            全选　共有 <span class="red" id="count_num_specialitem">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_specialitem"><strong>上一页</strong></button>
                            <span id="Span3">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_specialitem"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-specialitem-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _specialitemdata_table_id;
                            var _isosospecialitem = false;
                            $("#chkallSpecialitem").click(function () {
                                var $idsCheck = $("#data-specialitem-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindSpecialitem").click(function () {
                                _isosospecialitem = true;
                                $("#btnFindSpecialitem").attr("disabled", ""); _page(1)
                            });
                            $("#data-specialitem-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $price = $this.attr("price");
                                var $id = $this.val();
                                var $selecttr = $("#" + _specialitemdata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _specialitemdata_table_id + " tr").length < 9) {
                                        var t = (_specialitemdata_table_id == "specialitem_table") ? "specialitem[0][]" : "specialitem[1][]";
                                        var _trtmp = "<tr id='" + _specialitemdata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' />" + $title + "【￥" + $price + "】</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _specialitemdata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddSpecialitem").click(function (e) {
                                e.preventDefault();
                                _specialitemdata_table_id = $(this).attr("rel");
                                $('#specialitemModel').modal('show');
                                $("#chkallSpecialitem").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_specialitem").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_specialitem").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var specialitemKey;
                                if (_isosospecialitem) {
                                    specialitemKey = $("#specialitemKey").val();
                                }

                                $.get("../Handler/SpecialItemRead.ashx",
                                    { "key": specialitemKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-specialitem-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input type="checkbox" name="check" price="' + item.SPECIALITEM_PRICE + '" cover="' + item.SPECIALITEM_COVER + '"  t="' + item.SPECIALITEM_NAME + '" value="' + item.SPECIALITEM_ID + '" /><img src="' + item.SPECIALITEM_COVER + '" style="width:40px;height:30px;margin:0 10px;" />' + item.SPECIALITEM_NAME + '【￥' + item.SPECIALITEM_PRICE + '】</label></li>';
                                            $("#data-specialitem-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_specialitem").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindSpecialitem").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
        <!--图片选择器-->
        <div id="photoModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择图片集</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            图片标题：
                            <input name="photoKey" id="photoKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindPhoto"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallPhoto" name="chkallPhoto" />
                            全选　共有 <span class="red" id="count_num_photo">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_photo"><strong>上一页</strong></button>
                            <span id="Span5">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_photo"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-photo-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _photodata_table_id;
                            var _isosophoto = false;
                            $("#chkallPhoto").click(function () {
                                var $idsCheck = $("#data-photo-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindPhoto").click(function () {
                                _isosophoto = true;
                                $("#btnFindPhoto").attr("disabled", ""); _page(1)
                            });
                            $("#data-photo-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $img = $this.attr("img");
                                var $id = $this.val();
                                var $selecttr = $("#" + _photodata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _photodata_table_id + " tr").length < 9) {
                                        var t = (_photodata_table_id == "photo_table") ? "photo[0][]" : "photo[1][]";
                                        var _trtmp = "<tr id='" + _photodata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' /><img src='" + $img + "' style='width:40px;height:30px;margin-right:20px;'/>" + $title + "</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _photodata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddPhoto").click(function (e) {
                                e.preventDefault();
                                _photodata_table_id = $(this).attr("rel");
                                $('#photoModel').modal('show');
                                $("#chkallPhoto").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_photo").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_photo").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var photoKey;
                                if (_isosophoto) {
                                    photoKey = $("#photoKey").val();
                                }

                                $.get("../Handler/PhotoRead.ashx",
                                    { "key": photoKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-photo-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input type="checkbox" name="check" img="' + item.PHOTO_URL + '"  t="' + item.PHOTO_NAME + '" value="' + item.PHOTO_ID + '" /><img src="' + item.PHOTO_URL + '" style="width:40px;height:30px;margin:0 20px" />' + item.PHOTO_NAME + '</label></li>';
                                            $("#data-photo-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_photo").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindPhoto").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
        <!--行程安排：-->
        <div id="tripModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><i class="icon-table"></i>选择主题集</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row-fluid">
                            主题标题：
                            <input name="tripKey" id="tripKey" type="text" style="margin-bottom: 0px;" class="input-medium" placeholder="输入标题进行查找" />
                            <button type="button" class="btn" id="btnFindTrip"><strong>查找</strong></button>
                        </div>
                        <p></p>
                        <div class="row-fluid">
                            <input type="checkbox" id="chkallTrip" name="chkallTrip" />
                            全选　共有 <span class="red" id="count_num_trip">0</span> 条符合条件
                            <button type="button" class="btn btn-mini" id="p_page_trip"><strong>上一页</strong></button>
                            <span id="Span6">第1页/共1页</span>
                            <button type="button" class="btn btn-mini" id="n_page_trip"><strong>下一页</strong></button>
                            <ul class="unstyled list-li-border" id="data-trip-list"></ul>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
                    </div>
                    <script type="text/javascript">
                        $(document).ready(function () {
                            var _tripdata_table_id;
                            var _isosotrip = false;
                            $("#chkallTrip").click(function () {
                                var $idsCheck = $("#data-trip-list input[name='check']")
                                var $this = $(this);
                                if ($this.attr("checked")) {
                                    $idsCheck.attr("checked", true);
                                } else {
                                    $idsCheck.attr("checked", false);
                                }
                                $idsCheck.each(function () {
                                    _tr($(this));
                                });

                            });
                            $("#btnFindTrip").click(function () {
                                _isosotrip = true;
                                $("#btnFindTrip").attr("disabled", ""); _page(1)
                            });
                            $("#data-trip-list input[name='check']").live("click", function () { _tr($(this)); });
                            var _tr = function (_t) {
                                var $this = _t;
                                var $title = $this.attr("t");
                                var $id = $this.val();
                                var $selecttr = $("#" + _tripdata_table_id + "tr" + $id + "");
                                if ($this.attr("checked")) {
                                    if ($selecttr.length == 0 && $("#" + _tripdata_table_id + " tr").length < 20) {
                                        var t = (_tripdata_table_id == "trip_table") ? "trip[0][]" : "trip[1][]";
                                        var _trtmp = "<tr id='" + _tripdata_table_id + "tr" + $id + "'><td><input type='hidden' name='" + t + "'  value='" + $id + "' />" + $title + "</td><td><a href='javascript:void(0)' class='btn btn-mini del'><i class='icon-remove'></i></a></td></tr>";
                                        $("#" + _tripdata_table_id + "").append(_trtmp);
                                    }

                                } else {
                                    $selecttr.remove();
                                }
                            }
                            //删除
                            $("table.dataTable-mini .del").live("click", function () {
                                $(this).parent().parent().remove();
                            });
                            $("#btnAddTrip").click(function (e) {
                                e.preventDefault();
                                _tripdata_table_id = $(this).attr("rel");
                                $('#tripModel').modal('show');
                                $("#chkallTrip").attr("checked", false);
                                _page(1);
                            });
                            $("#p_page_trip").click(function () {
                                if (_this_page - 1 > 0) {
                                    _this_page--;
                                    _page(_this_page);
                                }
                            });
                            $("#n_page_trip").click(function () {
                                if (_this_page + 1 <= _this_page_count) {
                                    _this_page++;
                                    _page(_this_page);
                                }
                            });
                            var _this_page = 1;//当前页
                            var _this_page_count = 0;//总页数
                            var _page = function (_index) {
                                var tripKey;
                                if (_isosotrip) {
                                    tripKey = $("#tripKey").val();
                                }

                                $.get("../Handler/TripRead.ashx",
                                    { "key": tripKey, "page": _index, },
                                    function (data, textStatus) {
                                        $("#data-trip-list").html("");
                                        $.each(data.list, function (index, item) {
                                            var _li_tmp = '<li><label><input type="checkbox" name="check" t="' + item.TRIP_NAME + '" value="' + item.TRIP_ID + '" />' + item.TRIP_NAME + '</label></li>';
                                            $("#data-trip-list").append(_li_tmp);
                                        });

                                        _this_page_count = data.count;
                                        $("#count_num_trip").text(data.total);
                                        $("#p_page_str").text("第" + _this_page + "页/共" + _this_page_count + "页");
                                        $("#btnFindTrip").removeAttr("disabled")
                                    }, "json");
                            }
                        })
                    </script>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
